Introduce build option to override libc
authorVarun Wadekar <[email protected]>
Thu, 31 Jan 2019 17:22:30 +0000 (09:22 -0800)
committerVarun Wadekar <[email protected]>
Tue, 5 Feb 2019 16:27:32 +0000 (08:27 -0800)
This patch introduces a build option 'OVERRIDE_LIBC' that platforms
can set to override libc from the BL image. The default value is '0'
to keep the library.

Change-Id: I10a0b247f6a782eeea4a0359e30a8d79b1e9e4e1
Signed-off-by: Varun Wadekar <[email protected]>
Makefile
docs/user-guide.rst
make_helpers/defaults.mk

index 0169f3f62b1944b0aa18b708e4e558736d74a0ea..34f6890bba18c9164065a32cfcb4755f4d63277b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -248,7 +248,6 @@ DTC_CPPFLAGS                +=      -nostdinc -Iinclude -undef -x assembler-with-cpp
 # Common sources and include directories
 ################################################################################
 include lib/compiler-rt/compiler-rt.mk
-include lib/libc/libc.mk
 
 BL_COMMON_SOURCES      +=      common/bl_common.c                      \
                                common/tf_log.c                         \
@@ -392,6 +391,13 @@ endif
 
 endif
 
+################################################################################
+# Include libc if not overridden
+################################################################################
+ifeq (${OVERRIDE_LIBC},0)
+include lib/libc/libc.mk
+endif
+
 ################################################################################
 # Check incompatible options
 ################################################################################
@@ -595,6 +601,7 @@ $(eval $(call assert_boolean,HANDLE_EA_EL3_FIRST))
 $(eval $(call assert_boolean,HW_ASSISTED_COHERENCY))
 $(eval $(call assert_boolean,MULTI_CONSOLE_API))
 $(eval $(call assert_boolean,NS_TIMER_SWITCH))
+$(eval $(call assert_boolean,OVERRIDE_LIBC))
 $(eval $(call assert_boolean,PL011_GENERIC_UART))
 $(eval $(call assert_boolean,PROGRAMMABLE_RESET_ADDRESS))
 $(eval $(call assert_boolean,PSCI_EXTENDED_STATE_ID))
index 3828eaff128cfb77a7ce2b4260b4773e933bc426..63b0f36ea2019972ad3dbe19944cacf75913d4d4 100644 (file)
@@ -581,6 +581,10 @@ Common build options
    1 (do save and restore). 0 is the default. An SPD may set this to 1 if it
    wants the timer registers to be saved and restored.
 
+- ``OVERRIDE_LIBC``: This option allows platforms to override the default libc
+   for the BL image. It can be either 0 (include) or 1 (remove). The default
+   value is 0.
+
 -  ``PL011_GENERIC_UART``: Boolean option to indicate the PL011 driver that
    the underlying hardware is not a full PL011 UART but a minimally compliant
    generic UART, which is a subset of the PL011. The driver will not access
index c1aa3205248edbad3c216767f828749468738b9c..76a9fd4fab10bcb790161d8d2b8fe48a94c5a359 100644 (file)
@@ -122,6 +122,9 @@ MULTI_CONSOLE_API           := 0
 # NS timer register save and restore
 NS_TIMER_SWITCH                        := 0
 
+# Include lib/libc in the final image
+OVERRIDE_LIBC                  := 0
+
 # Build PL011 UART driver in minimal generic UART mode
 PL011_GENERIC_UART             := 0